package com.hfi.compositepattern.demo02;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ChangLiang
 * @date 2020/4/26
 */
public class Employee {

    private String name;

    private String dept;

        private List<Employee> subordinates = new ArrayList<>();

    public Employee(String name, String dept) {
        this.name = name;
        this.dept = dept;
    }

    public void add(Employee employee) {
        subordinates.add(employee);
    }

    public List<Employee> getSubordinates() {
        return subordinates;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", dept='" + dept + '\'' +
                ", subordinates=" + subordinates +
                '}';
    }
}
